package com.letoo.sso.dataaccess.dao.db;

import org.apache.ibatis.annotations.Param;

import com.letoo.sso.dataaccess.datasource.DbRepository;
import com.letoo.sso.dataaccess.domain.dbo.UserDO;

/**
 * 用户表DAO
 * 
 * @author dengjie
 * 
 */
@DbRepository
public interface UserDBDAO extends BaseDBDAO<UserDO> {

    public int mobileIsExisted(@Param("mobile") String mobile);

    public UserDO queryUserByMobile(@Param("mobile") String mobile);

    public UserDO queryUserByMiaoId(@Param("miaoId") String miaoId);

    public Long queryUserIdByMobile(@Param("mobile") String mobile);

    public Long queryUserIdByMiaoId(@Param("miaoId") String miaoId);

    public UserDO queryUserByUserId(@Param("userId") long userId);
    
    public int updatePassword(@Param("userId") long userId,@Param("newPassword") String newPassword);
    
    public int updateLastLoginTimeAndLoginFrequency(@Param("userId") long userId);

    public int updateLastLoginTimeAndLoginFrequencyAndOnlineStatus(@Param("loginFrequency") int loginFrequency,@Param("userId") long userId,@Param("onlineStatus") int onlineStatus);
    
    public int updateOnlineStatus(@Param("onlineStatus") int onlineStatus,@Param("userId") long userId);
}
